package com.example.tuter.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import com.example.tuter.entity.UserInfo;

import java.util.List;

@Dao
public interface UserInfoDao {
    /**
     * 插入数据，onConflict = OnConflictStrategy.REPLACE表明若存在主键相同的情况则直接覆盖
     * 返回的long表示的是插入项新的id
     * @param
     * @return
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long insertUserInfo(UserInfo user);

    @Query("Select * from userinfo")
    List<UserInfo> getAllUserList();
}
